import {connect ,useSelector ,useDispatch} from "react-redux"
import {addNum  ,asyncFun} from "../../toolkitStore/index"
function TextStore(props){
    useSelector((state)=>{
        console.log(111,state);
        
    })
    let dispatch = useDispatch()
    return (
        <>
        <div>toolkit{props.num}</div>
        <div>2222{props.mes}</div>
        <div>异步数据{props.opp}</div>
        <button onClick={()=>{
            //   props.changeNum(3)
            dispatch(addNum(3))
        }}>改变数据</button>
        <button onClick={()=>{
            dispatch(asyncFun())
        }}>异步修改数据</button>
        </>
    )
}


const  connectAPP=connect((state)=>{
    return state.mesSlice2
},(dispatch)=>{
    return {
        changeNum(value){ 
            dispatch(addNum(value))
            
        }
    }
})(TextStore)
export default connectAPP